package com.icongyou.enterprise.talent_marking.controller;

import com.icongyou.enterprise.common.result.Result;
import com.icongyou.enterprise.talent_marking.entity.dto.MarkRequest;
import com.icongyou.enterprise.talent_marking.entity.vo.StudentBasicInfo;
import com.icongyou.enterprise.talent_marking.entity.vo.StudentFocusMark;
import com.icongyou.enterprise.talent_marking.service.StudentFocusMarkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/studentmark")
public class StudentFocusMarkController {
    @Autowired
    private StudentFocusMarkService studentFocusMarkService;

    // 标记或更新标记
    @PostMapping("/mark")
    public Result markStudent(@RequestBody MarkRequest mark) {
        return studentFocusMarkService.markStudent(mark);
    }

    // 取消关注，使用查询参数
    @DeleteMapping("/unmark")
    public Result unmarkStudent(@RequestParam String userId, @RequestParam String studentId) {
        return studentFocusMarkService.unmarkStudent(userId, studentId);
    }

    // 获取某用户的关注列表
    @GetMapping("/list/{userId}")
    public Result getFocusStudentsByUser(@PathVariable String userId) {
        return studentFocusMarkService.getFocusStudentsByUser(userId);
    }

    // 检查是否已关注
    @GetMapping("/isMarked")
    public Result isStudentFocusMarked(@RequestParam String userId, @RequestParam String studentId) {
        return studentFocusMarkService.isStudentFocusMarked(userId, studentId);
    }
    /**
     * 获取当前用户的关注学生详细信息列表
     */
    @GetMapping("/student-info")
    public Result<List<StudentBasicInfo>> getFocusStudentInfo(@RequestParam String userId){
        return studentFocusMarkService.getFocusStudentInfo(userId);
    }
}
